var vConsole = new VConsole();
var DOMAIN='http://demo.yeahyo.cn/test/qqbrowser/2018novel/authtest/';// 授权回调地址
var auth_url='http://migmkt.qq.com/g/act/auth.html';//授权url
var _token='H8L9gvuv0XZWcMGRNBG9s/HGDuN8sN2x0SgOyuxUykmYfg7c4gu8HIyB4cJsU3L3';//授权token参数
var COOKIE_NAME='tx_cookie2';
var _nickname=GetQueryString('nickname')?GetQueryString('nickname'):false;
getUserInfo();
function getUserInfo(){"use strict";					   
	if(_nickname){ 
		$.cookie(COOKIE_NAME,JSON.stringify(_nickname),{ expires: 365, path: '/' });
		console.log(_nickname);
		alert(_nickname);
		return;
	}	
	if($.cookie(COOKIE_NAME)) { 
		_nickname=JSON.parse($.cookie(COOKIE_NAME));
		console.log(_nickname);
		alert(_nickname);
		return;
	}

	window.location.href=auth_url+'?token='+_token+'&ref='+encodeURIComponent(DOMAIN);	
}
function GetQueryString(key) {
    var url = window.location.search;    
    var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");// 正则筛选地址栏   
    var result = url.substr(1).match(reg); // 匹配目标参数   
    return result ? decodeURIComponent(result[2]) : null;
}


